<template>
  <div class="room-list">
    <div class="room-inner">
      <div class="room-title">房间列表
        <div class="room-close" @click="close"></div>
      </div>
      <div class="room-content">
        <div class="room-list-scenes">
          <div class="room-scene" v-for="(scene,i) in scenes" :key="i">
            <div class="scene-title">{{scene.title}}</div>
            <img :src="scene.thumburl" @click="into(scene)">
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    scenes: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  methods: {
    into(scene) {
      krpano.call(`loadscene(${scene.name})`);
    },
    close() {
      this.$emit("close", false);
    }
  },
  mounted() {}
};
</script>

<style lang="scss">
.room-list {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  background: #fff;
  .room-inner {
    padding: 0 24px;
  }
  .room-title {
    position: relative;
    font-size: 36px;
    padding: 40px 0 24px;
    border-bottom: 2px solid #e5e2e2;
  }
  .room-close {
    position: absolute;
    top: 24px;
    right: 0;
    height: 44px;
    width: 44px;
    background: url("/images/close.png") 0 0 no-repeat / cover;
    cursor: pointer;
  }

  .room-content {
    height: 700px;
    overflow: auto;
  }
  .room-list-scenes {
    /*border-bottom:2px solid #E5E2E2;*/
  }
  .room-scene {
    position: relative;
    display: inline-block;
    vertical-align: top;
    /*border:2px solid #E5E2E2;*/
    width: 50%;
    box-sizing: border-box;
    text-align: center;
    > img {
      width: 324px;
      height: 240px;
      vertical-align: top;
    }
    .scene-title {
      position: absolute;
      bottom: 48px;
      left: 50%;
      transform: translate3d(-50%, 0, 0);
      height: 44px;
      line-height: 44px;
      padding: 0 16px;
      background: rgba(0, 0, 0, 0.6);
      color: #fff;
      font-size: 24px;
    }
    border-bottom: 2px solid #e5e2e2;
  }
  .room-scene:nth-child(even) {
    padding: 20px 0 20px 20px;
  }
  .room-scene:nth-child(odd) {
    padding: 20px 20px 20px 0;
    border-right: 2px solid #e5e2e2;
  }
}
</style>
